package org.jeecg.modules.solitaire_app.app.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.solitaire_app.app.entity.YsyDrivingTrackAddress;
import org.jeecg.modules.solitaire_app.app.mapper.YsyDrivingTrackAddressMapper;
import org.jeecg.modules.solitaire_app.app.service.IYsyDrivingTrackAddressService;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
 * @Description: 轨迹下单地址
 * @Author: jeecg-boot
 * @Date: 2023-12-19
 * @Version: V1.0
 */
@Service
@DS("ysy_db")
public class YsyDrivingTrackAddressServiceImpl extends ServiceImpl<YsyDrivingTrackAddressMapper, YsyDrivingTrackAddress> implements IYsyDrivingTrackAddressService {

    @Override
    public Result<PageInfo<YsyDrivingTrackAddress>> getYsyDrivingTrackAddress(Map<String, Object> map) {
        Result<PageInfo<YsyDrivingTrackAddress>> result = new Result<>();
        try {
            PageHelper.startPage(Integer.parseInt(map.get("pageNo").toString()), Integer.parseInt(map.get("pageSize").toString()));
            List<YsyDrivingTrackAddress> ysyDrivingTrackAddresses = this.baseMapper.getYsyDrivingTrackAddress(map);
            PageInfo<YsyDrivingTrackAddress> pageInfo = new PageInfo<>(ysyDrivingTrackAddresses);
            result.setCode(200);
            result.setResult(pageInfo);
            result.setSuccess(true);
            return result;
        }catch (Exception e){
            result.setCode(500);
            result.setMessage("服务器响应失败");
            result.setSuccess(false);
            return result;
        }
    }
}
